const http = require('http');
const {knife4jConfig} = require("../../notifier.config");

function getInterfaceInfo() {
    const options = {
        hostname: knife4jConfig.hostname,
        port: knife4jConfig.port,
        path: '/v2/api-docs',
        method: 'GET',
    };
    return new Promise(((resolve) => {
        const req = http.request(options, (res) => {
            res.setEncoding('utf8');
            res.on('data', (chunk) => {
                resolve(chunk);
            });
        });

        req.on('error', (e) => {
            resolve(null)
        });
        req.end();
    }))
}

module.exports = {
    getInterfaceInfo,
}
